package day_2022_9_to_12.Day;

/**
 * @author haomin
 * @date 2022/09/29 22:29
 **/
public class Day28_5_Num190_ReverseBits {
    public class Solution {
        // you need treat n as an unsigned value
        public int reverseBits(int n) {
            int ans = 0;
            int i = 32;
            while(i-- > 0){
                ans <<= 1;
                ans += (n & 1);
                n >>= 1;
            }
            return ans;
        }
    }
}